import axios from 'axios';
import { loginreq, req } from './axiosFun';

/**
 * 管理员管理
 **/

// 登录接口
export const login = (params) => { return loginreq("post", "/api/admin/login", JSON.stringify(params)) };
// 获取管理员列表
export const List = (page, pagesize) => { return req("get", "/api/admin/list?page=" + page + "&pagesize=" + pagesize) };
// 删除管理员
export const Delete = (id) => { return req("post", "/api/admin/delete", { id: id }) };
// 注册管理员
export const Add = (form) => { return req("post", "/api/admin/add", JSON.stringify(form)) };
// 更新管理员信息
export const Update = (form) => { return req("post", "/api/admin/update", JSON.stringify(form)) };
// 获取管理员名字与id的映射表
export const adminOptions = () => { return req("get", "/api/admin/options") }
    // 获取学院ID映射表
export const collegeOptions = () => { return req("get", "/api/colleges/options") }



/**
 * 场地管理
 **/
// 获取场地
export const FieldList = (page, pagesize) => { return req("get", "/api/article/?page=" + page + "&pagesize=" + pagesize) };
// 删除场地
export const FieldDelete = (id) => { return req("post", "/api/article/delete", { id: id }) };
// 添加场地
export const FieldAdd = (form) => { return req("post", "/api/article/add", JSON.stringify(form)) };
// 更新场地
export const FieldUpdate = (form) => { return req("post", "/api/article/update", JSON.stringify(form)) };